#!/bin/bash

set -uex

doabfbuild=""
plast=""
while [ -n "${1:-}" ]
do
	case "$1" in
		-b) doabfbuild="1" ;;
		*)  plast="$1" ;;
	esac
	shift
done

git checkout rosa2023.1
git pull
git checkout rosa2021.1
git merge rosa2023.1
git checkout rosa2023.1
git push --all

if [ -n "$doabfbuild" ]
then
	abf build -p import/$(basename $PWD) -b rosa2023.1
	abf build -p import/$(basename $PWD) -b rosa2021.1
fi
